let Config = function() {
    this.key = "";
    this.value = "";
    this.desc = "";
    this.enable = true;
};

Config.prototype.toBSON = function() {
    return {
        key : this.key,
        value : this.value,
        desc : this.desc,
        enable : this.enable
    };
};

Config.prototype.toJSON = function () {
    return {
        key : this.key,
        value : this.value,
        desc : this.desc,
        enable : this.enable
    };
};

Config.prototype.toSimpleJSON = function () {
    return {
        key : this.key,
        value : this.value
    };
};

module.exports.create = function(key, value, desc, enable) {
    let config = new Config();
    config.key = key;
    config.value = value;
    config.desc = desc;
    config.enable = enable;
    return config;
};

module.exports.loadFromDocument = function (document) {
    let config = new Config();
    config.key = document["key"];
    config.value = document["value"];
    config.desc = document["desc"];
    config.enable = document["enable"];
    return config;
};
